package cn.kgc.springboot;

import cn.kgc.springboot.controller.HelloController;
import cn.kgc.springboot.entity.Student;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;


/**
 * springboot工程启动类
 * @SpringBootApplication   注解  组合注解
 *
 *  1. @SpringBootConfiguration    spring 的相关配置
 *  2. @EnableAutoConfiguration   整合第三方框架时 自动配置
 *  3. @ComponentScan    包扫描      注解所添加类所在的包及其子包
 *
 */
@SpringBootApplication  // 标识pringboot工程启动类
public class Springboot01Application {

    public static void main(String[] args) {

        // 启动spring容器
        ApplicationContext ac = SpringApplication.run(Springboot01Application.class, args);
        HelloController bean = ac.getBean(HelloController.class);
        System.out.println("bean = " + bean);

        Student bean1 = ac.getBean(Student.class);
        System.out.println(bean1);

    }

}
